﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Wsq.Utils.DoNetFramework40.Socket.tools
{
    public class HttpSession
    {
        private string _JSessionID;
        private Dictionary<string, object> keyValues = new Dictionary<string, object>();
        public void SetItem(string key, object value) 
        {
            if (keyValues.ContainsKey(key))
            {
                keyValues[key] = value;
            }
            else
            {
                keyValues.Add(key, value);
            }
        }
        public object getItem(string key)
        {
            if (keyValues.ContainsKey(key))
            {
                return keyValues[key];
            }
            else
            {
                return null;
            }
        }
        public string JSessionID
        {
            get { return _JSessionID; }
        }
        public HttpSession(int r) 
        {
            string temp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss" + " " + r);
            _JSessionID=MD5Help.MD5Encrypt32(temp);
        }
        public void RemoveItem(string key) 
        {
            keyValues.Remove(key);
        }

    }
}
